<template>
    <div>
      <!-- 这是学生自己的信息修改界面 -->
      <el-form
        style="padding: 5px; margin-left:10px"
        :model="student"
        v-if="user.userFlag === '8'"
      >
      <br>
        <el-form-item label="学生账号" prop="studentId">
          <el-input v-model="student.studentId" style="width: 200px" disabled></el-input>
        </el-form-item>
        <el-form-item label="学生姓名" prop="studentName">
          <el-input
            v-model="student.studentName"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="学生身份证号" prop="studentIdentityid">
          <el-input
            v-model="student.studentIdentityid"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="学生年龄" prop="studentAge">
          <el-input
            v-model="student.studentAge"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="学生密码" prop="studentPassword">
          <el-input
            v-model="student.studentPassword"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item
          label="所属校区"
          prop="studentSchool"
        >
          <el-input
            v-model="student.studentSchool"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item
          label="所属学院"
          prop="studentObject"
        >
          <el-input
            v-model="student.studentObject"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item
          label="所属年级"
          prop="studentGrade"
        >
          <el-input
            v-model="student.studentGrade"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item
          label="所属班级"
          prop="studentClass"
        >
          <el-input
            v-model="student.studentClass"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="联系电话" prop="studentPhone">
          <el-input
            v-model="student.studentPhone"
            style="width: 200px"
          ></el-input>
        </el-form-item>
      </el-form>

      <!-- 这是用户自己的信息修改界面 -->
      <el-form
        style="padding: 5px; margin-left:10px"
        :model="user"
        v-if="user.userFlag != '8'"
      >
      <br>
        <el-form-item label="用户账号" prop="userId">
          <el-input v-model="user.userId" style="width: 200px" disabled></el-input>
        </el-form-item>
        <el-form-item label="用户姓名" prop="userName">
          <el-input
            v-model="user.userName"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item label="用户密码" prop="userPassword">
          <el-input
            v-model="user.user_password"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="用户权限" prop="userFlag">
          <el-input
            v-model="user.userFlag"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item
          v-if="user.userFlag === '7'"
          label="所属校区"
          prop="userSchool"
        >
          <el-input
            v-model="user.userSchool"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item
          v-if="user.userFlag != '7'&& user.userFlag != '1'"
          label="所属学院"
          prop="userObject"
        >
          <el-input
            v-model="user.userObject"
            style="width: 200px"
            disabled
          ></el-input>
        </el-form-item>
        <el-form-item
          v-if="user.userFlag === '4'|| user.userFlag === '5'"
          label="所属年级"
          prop="userGrade"
        >
          <el-input
            v-model="user.userGrade"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item
          v-if="user.userFlag === '5'"
          label="所属班级"
          prop="userClass"
        >
          <el-input
            v-model="user.userClass"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="联系电话" prop="userPhone">
          <el-input
            v-model="user.userPhone"
            style="width: 200px"
          ></el-input>
        </el-form-item>
        <el-form-item label="办公地址" prop="userAddress">
          <el-input
            v-model="user.userAddress"
            style="width: 200px"
          ></el-input>
        </el-form-item>
      </el-form>
    
    </div>
</template>

<script>
export default {
    data(){
        return {
            user: {},
            student: {}
        }
    },
    created() {
        let userStr = sessionStorage.getItem("user") || "{}";
        this.user = JSON.parse(userStr);
        if(this.user.userFlag == '8'){
          console.log("嘿嘿");
          this.student = this.user.student;
          console.log(this.student);
        }
        console.log(this.user)
    },
}
</script>